<?php 
class BaseClass
{
	function __construct()
	{
		echo "BaseClass Construct";
	}
	function __get($property_name)
	{
		if(isset($this->$property_name))
		{
			return ($this->$property_name);
		}
		else
		{
			return NULL;
		}
	}
	function __set($property_name,$value)
	{
		$this->$property_name = $value;
	}
		
	function scanfiles($dir)
	{
		if(!is_dir($dir)) return array();
		$dir = rtrim(str_replace('\\','/',$dir),'/').'/';
		$dirs = array($dir);
		$rt = array();
		do
		{
			$dir = array_pop($dirs);
			$tmp = scandir($dir);
			foreach($tmp as $f)
			{
				if($f == '.' || $f == '..') continue;
				$path = $dir . $f;
				if(is_dir($path))
				{
					array_push($dirs,$path.'/');
				}else if(is_file($path))
				{
					$rt[] = $path;
				}
			}
		}while($dirs);
		return $rt;
	}
	function getFileFullName($path)
	{
		$pos = strrpos($path,"/");
		$fileName = substr($path,$pos+1,strlen($path));
		return $fileName;
	}
	
	function getFileName($path)
	{
		$fileFullName = $this->getFileFullName($path);
		$pos = strrpos($fileFullName,".");
		$fileName = substr($fileFullName,0,$pos);
		return $fileName;
	}
	function getSuffix($path)
	{
		$fileFullName = $this->getFileFullName($path);
		$pos = strrpos($fileFullName,".");
		$suffix = substr($fileFullName,$pos+1,strlen($fileFullName));
		return $suffix;
	}
	function trimPath($path)
	{
		return rtrim(str_replace('\\','/',$path),'/').'/';
	}
	/**
	* 得到文件的后缀名字
	*/
	function get_extension($fileName)
	{
		return pathinfo($file, PATHINFO_EXTENSION);
	}
}
?>